package cn.cloudplug.friendsrecommend.view;

import cn.cloudplug.friendsrecommend.R;
import cn.cloudplug.friendsrecommend.util.Constant;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class LeftMenuItemView extends RelativeLayout{
	private ImageView iv_icon;
	private TextView tv_title;
	public TextView tv_message;
	public LeftMenuItemView(Context context, AttributeSet attrs) {
		super(context, attrs);
		setView(context);
		fillData(attrs);
	}
	
	private void fillData(AttributeSet attrs) {
		int home=attrs.getAttributeResourceValue(Constant.NAMESPACE, "src_home", 0);
		String text=attrs.getAttributeValue(Constant.NAMESPACE,"text");
		iv_icon.setImageResource(home);
		tv_title.setText(text);
	}

	private void setView(Context context) {
		View.inflate(context, R.layout.left_menu_item, this);
		iv_icon=(ImageView) findViewById(R.id.imageView1);
		tv_title=(TextView) findViewById(R.id.textView1);
		tv_message=(TextView) findViewById(R.id.textView2);
	}

}
